3.222 \(\int \frac{\cot ^4(e+f x)}{a+b \tan ^2(e+f x)} \, dx\)

Optimal. Leaf size=84 \[ -\frac{b^{5/2} \tan ^{-1}\left (\frac{\sqrt{b} \tan (e+f x)}{\sqrt{a}}\right )}{a^{5/2} f (a-b)}+\frac{(a+b) \cot (e+f x)}{a^2 f}+\frac{x}{a-b}-\frac{\cot ^3(e+f x)}{3 a f} \]

[Out]

x/(a - b) - (b^(5/2)*ArcTan[(Sqrt[b]*Tan[e + f*x])/Sqrt[a]])/(a^(5/2)*(a - b)*f) + ((a + b)*Cot[e + f*x])/(a^2
*f) - Cot[e + f*x]^3/(3*a*f)

________________________________________________________________________________________

Rubi [A]  time = 0.172941, antiderivative size = 84, normalized size of antiderivative = 1., number of steps used = 6, number of rules used = 6, integrand size = 23, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.261, Rules used = {3670, 480, 583, 522, 203, 205} \[ -\frac{b^{5/2} \tan ^{-1}\left (\frac{\sqrt{b} \tan (e+f x)}{\sqrt{a}}\right )}{a^{5/2} f (a-b)}+\frac{(a+b) \cot (e+f x)}{a^2 f}+\frac{x}{a-b}-\frac{\cot ^3(e+f x)}{3 a f} \]

Antiderivative was successfully verified.

[In]

Int[Cot[e + f*x]^4/(a + b*Tan[e + f*x]^2),x]

[Out]

x/(a - b) - (b^(5/2)*ArcTan[(Sqrt[b]*Tan[e + f*x])/Sqrt[a]])/(a^(5/2)*(a - b)*f) + ((a + b)*Cot[e + f*x])/(a^2
*f) - Cot[e + f*x]^3/(3*a*f)

Rule 3670

Int[((d_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol]
 :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist[(c*ff)/f, Subst[Int[(((d*ff*x)/c)^m*(a + b*(ff*x)^n)^p)/(c^
2 + ff^2*x^2), x], x, (c*Tan[e + f*x])/ff], x]] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && (IGtQ[p, 0] || EqQ
[n, 2] || EqQ[n, 4] || (IntegerQ[p] && RationalQ[n]))

Rule 480

Int[((e_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^(q_), x_Symbol] :> Simp[((e*x)^(m
 + 1)*(a + b*x^n)^(p + 1)*(c + d*x^n)^(q + 1))/(a*c*e*(m + 1)), x] - Dist[1/(a*c*e^n*(m + 1)), Int[(e*x)^(m +
n)*(a + b*x^n)^p*(c + d*x^n)^q*Simp[(b*c + a*d)*(m + n + 1) + n*(b*c*p + a*d*q) + b*d*(m + n*(p + q + 2) + 1)*
x^n, x], x], x] /; FreeQ[{a, b, c, d, e, p, q}, x] && NeQ[b*c - a*d, 0] && IGtQ[n, 0] && LtQ[m, -1] && IntBino
mialQ[a, b, c, d, e, m, n, p, q, x]

Rule 583

Int[((g_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.)*((e_) + (f_.)*(x_)^(n_)),
x_Symbol] :> Simp[(e*(g*x)^(m + 1)*(a + b*x^n)^(p + 1)*(c + d*x^n)^(q + 1))/(a*c*g*(m + 1)), x] + Dist[1/(a*c*
g^n*(m + 1)), Int[(g*x)^(m + n)*(a + b*x^n)^p*(c + d*x^n)^q*Simp[a*f*c*(m + 1) - e*(b*c + a*d)*(m + n + 1) - e
*n*(b*c*p + a*d*q) - b*e*d*(m + n*(p + q + 2) + 1)*x^n, x], x], x] /; FreeQ[{a, b, c, d, e, f, g, p, q}, x] &&
 IGtQ[n, 0] && LtQ[m, -1]

Rule 522

Int[((e_) + (f_.)*(x_)^(n_))/(((a_) + (b_.)*(x_)^(n_))*((c_) + (d_.)*(x_)^(n_))), x_Symbol] :> Dist[(b*e - a*f
)/(b*c - a*d), Int[1/(a + b*x^n), x], x] - Dist[(d*e - c*f)/(b*c - a*d), Int[1/(c + d*x^n), x], x] /; FreeQ[{a
, b, c, d, e, f, n}, x]

Rule 203

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTan[(Rt[b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 205

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]*ArcTan[x/Rt[a/b, 2]])/a, x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rubi steps

\begin{align*} \int \frac{\cot ^4(e+f x)}{a+b \tan ^2(e+f x)} \, dx &=\frac{\operatorname{Subst}\left (\int \frac{1}{x^4 \left (1+x^2\right ) \left (a+b x^2\right )} \, dx,x,\tan (e+f x)\right )}{f}\\ &=-\frac{\cot ^3(e+f x)}{3 a f}+\frac{\operatorname{Subst}\left (\int \frac{-3 (a+b)-3 b x^2}{x^2 \left (1+x^2\right ) \left (a+b x^2\right )} \, dx,x,\tan (e+f x)\right )}{3 a f}\\ &=\frac{(a+b) \cot (e+f x)}{a^2 f}-\frac{\cot ^3(e+f x)}{3 a f}-\frac{\operatorname{Subst}\left (\int \frac{-3 \left (a^2+a b+b^2\right )-3 b (a+b) x^2}{\left (1+x^2\right ) \left (a+b x^2\right )} \, dx,x,\tan (e+f x)\right )}{3 a^2 f}\\ &=\frac{(a+b) \cot (e+f x)}{a^2 f}-\frac{\cot ^3(e+f x)}{3 a f}+\frac{\operatorname{Subst}\left (\int \frac{1}{1+x^2} \, dx,x,\tan (e+f x)\right )}{(a-b) f}-\frac{b^3 \operatorname{Subst}\left (\int \frac{1}{a+b x^2} \, dx,x,\tan (e+f x)\right )}{a^2 (a-b) f}\\ &=\frac{x}{a-b}-\frac{b^{5/2} \tan ^{-1}\left (\frac{\sqrt{b} \tan (e+f x)}{\sqrt{a}}\right )}{a^{5/2} (a-b) f}+\frac{(a+b) \cot (e+f x)}{a^2 f}-\frac{\cot ^3(e+f x)}{3 a f}\\ \end{align*}

Mathematica [A]  time = 0.647017, size = 92, normalized size = 1.1 \[ \frac{\sqrt{a} \left (3 a^2 (e+f x)-(a-b) \cot (e+f x) \left (a \csc ^2(e+f x)-4 a-3 b\right )\right )-3 b^{5/2} \tan ^{-1}\left (\frac{\sqrt{b} \tan (e+f x)}{\sqrt{a}}\right )}{3 a^{5/2} f (a-b)} \]

Antiderivative was successfully verified.

[In]

Integrate[Cot[e + f*x]^4/(a + b*Tan[e + f*x]^2),x]

[Out]

(-3*b^(5/2)*ArcTan[(Sqrt[b]*Tan[e + f*x])/Sqrt[a]] + Sqrt[a]*(3*a^2*(e + f*x) - (a - b)*Cot[e + f*x]*(-4*a - 3
*b + a*Csc[e + f*x]^2)))/(3*a^(5/2)*(a - b)*f)

________________________________________________________________________________________

Maple [A]  time = 0.079, size = 104, normalized size = 1.2 \begin{align*} -{\frac{1}{3\,fa \left ( \tan \left ( fx+e \right ) \right ) ^{3}}}+{\frac{1}{fa\tan \left ( fx+e \right ) }}+{\frac{b}{f{a}^{2}\tan \left ( fx+e \right ) }}-{\frac{{b}^{3}}{f{a}^{2} \left ( a-b \right ) }\arctan \left ({b\tan \left ( fx+e \right ){\frac{1}{\sqrt{ab}}}} \right ){\frac{1}{\sqrt{ab}}}}+{\frac{\arctan \left ( \tan \left ( fx+e \right ) \right ) }{f \left ( a-b \right ) }} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(f*x+e)^4/(a+b*tan(f*x+e)^2),x)

[Out]

-1/3/f/a/tan(f*x+e)^3+1/f/a/tan(f*x+e)+1/f/a^2/tan(f*x+e)*b-1/f/a^2*b^3/(a-b)/(a*b)^(1/2)*arctan(b*tan(f*x+e)/
(a*b)^(1/2))+1/f/(a-b)*arctan(tan(f*x+e))

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)^4/(a+b*tan(f*x+e)^2),x, algorithm="maxima")

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [A]  time = 1.19186, size = 702, normalized size = 8.36 \begin{align*} \left [\frac{12 \, a^{2} f x \tan \left (f x + e\right )^{3} - 3 \, b^{2} \sqrt{-\frac{b}{a}} \log \left (\frac{b^{2} \tan \left (f x + e\right )^{4} - 6 \, a b \tan \left (f x + e\right )^{2} + a^{2} + 4 \,{\left (a b \tan \left (f x + e\right )^{3} - a^{2} \tan \left (f x + e\right )\right )} \sqrt{-\frac{b}{a}}}{b^{2} \tan \left (f x + e\right )^{4} + 2 \, a b \tan \left (f x + e\right )^{2} + a^{2}}\right ) \tan \left (f x + e\right )^{3} + 12 \,{\left (a^{2} - b^{2}\right )} \tan \left (f x + e\right )^{2} - 4 \, a^{2} + 4 \, a b}{12 \,{\left (a^{3} - a^{2} b\right )} f \tan \left (f x + e\right )^{3}}, \frac{6 \, a^{2} f x \tan \left (f x + e\right )^{3} - 3 \, b^{2} \sqrt{\frac{b}{a}} \arctan \left (\frac{{\left (b \tan \left (f x + e\right )^{2} - a\right )} \sqrt{\frac{b}{a}}}{2 \, b \tan \left (f x + e\right )}\right ) \tan \left (f x + e\right )^{3} + 6 \,{\left (a^{2} - b^{2}\right )} \tan \left (f x + e\right )^{2} - 2 \, a^{2} + 2 \, a b}{6 \,{\left (a^{3} - a^{2} b\right )} f \tan \left (f x + e\right )^{3}}\right ] \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)^4/(a+b*tan(f*x+e)^2),x, algorithm="fricas")

[Out]

[1/12*(12*a^2*f*x*tan(f*x + e)^3 - 3*b^2*sqrt(-b/a)*log((b^2*tan(f*x + e)^4 - 6*a*b*tan(f*x + e)^2 + a^2 + 4*(
a*b*tan(f*x + e)^3 - a^2*tan(f*x + e))*sqrt(-b/a))/(b^2*tan(f*x + e)^4 + 2*a*b*tan(f*x + e)^2 + a^2))*tan(f*x
+ e)^3 + 12*(a^2 - b^2)*tan(f*x + e)^2 - 4*a^2 + 4*a*b)/((a^3 - a^2*b)*f*tan(f*x + e)^3), 1/6*(6*a^2*f*x*tan(f
*x + e)^3 - 3*b^2*sqrt(b/a)*arctan(1/2*(b*tan(f*x + e)^2 - a)*sqrt(b/a)/(b*tan(f*x + e)))*tan(f*x + e)^3 + 6*(
a^2 - b^2)*tan(f*x + e)^2 - 2*a^2 + 2*a*b)/((a^3 - a^2*b)*f*tan(f*x + e)^3)]

________________________________________________________________________________________

Sympy [A]  time = 89.7141, size = 823, normalized size = 9.8 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)**4/(a+b*tan(f*x+e)**2),x)

[Out]

Piecewise((zoo*x, Eq(a, 0) & Eq(b, 0) & Eq(e, 0) & Eq(f, 0)), ((-x - 1/(f*tan(e + f*x)) + 1/(3*f*tan(e + f*x)*
*3) - 1/(5*f*tan(e + f*x)**5))/b, Eq(a, 0)), (15*f*x*tan(e + f*x)**5/(6*b*f*tan(e + f*x)**5 + 6*b*f*tan(e + f*
x)**3) + 15*f*x*tan(e + f*x)**3/(6*b*f*tan(e + f*x)**5 + 6*b*f*tan(e + f*x)**3) + 15*tan(e + f*x)**4/(6*b*f*ta
n(e + f*x)**5 + 6*b*f*tan(e + f*x)**3) + 10*tan(e + f*x)**2/(6*b*f*tan(e + f*x)**5 + 6*b*f*tan(e + f*x)**3) -
2/(6*b*f*tan(e + f*x)**5 + 6*b*f*tan(e + f*x)**3), Eq(a, b)), (zoo*x/a, Eq(e, -f*x)), (x*cot(e)**4/(a + b*tan(
e)**2), Eq(f, 0)), ((x - cot(e + f*x)**3/(3*f) + cot(e + f*x)/f)/a, Eq(b, 0)), (6*I*a**(5/2)*f*x*sqrt(1/b)*tan
(e + f*x)**3/(6*I*a**(7/2)*f*sqrt(1/b)*tan(e + f*x)**3 - 6*I*a**(5/2)*b*f*sqrt(1/b)*tan(e + f*x)**3) + 6*I*a**
(5/2)*sqrt(1/b)*tan(e + f*x)**2/(6*I*a**(7/2)*f*sqrt(1/b)*tan(e + f*x)**3 - 6*I*a**(5/2)*b*f*sqrt(1/b)*tan(e +
 f*x)**3) - 2*I*a**(5/2)*sqrt(1/b)/(6*I*a**(7/2)*f*sqrt(1/b)*tan(e + f*x)**3 - 6*I*a**(5/2)*b*f*sqrt(1/b)*tan(
e + f*x)**3) + 2*I*a**(3/2)*b*sqrt(1/b)/(6*I*a**(7/2)*f*sqrt(1/b)*tan(e + f*x)**3 - 6*I*a**(5/2)*b*f*sqrt(1/b)
*tan(e + f*x)**3) - 6*I*sqrt(a)*b**2*sqrt(1/b)*tan(e + f*x)**2/(6*I*a**(7/2)*f*sqrt(1/b)*tan(e + f*x)**3 - 6*I
*a**(5/2)*b*f*sqrt(1/b)*tan(e + f*x)**3) - 3*b**2*log(-I*sqrt(a)*sqrt(1/b) + tan(e + f*x))*tan(e + f*x)**3/(6*
I*a**(7/2)*f*sqrt(1/b)*tan(e + f*x)**3 - 6*I*a**(5/2)*b*f*sqrt(1/b)*tan(e + f*x)**3) + 3*b**2*log(I*sqrt(a)*sq
rt(1/b) + tan(e + f*x))*tan(e + f*x)**3/(6*I*a**(7/2)*f*sqrt(1/b)*tan(e + f*x)**3 - 6*I*a**(5/2)*b*f*sqrt(1/b)
*tan(e + f*x)**3), True))

________________________________________________________________________________________

Giac [B]  time = 1.60999, size = 504, normalized size = 6. \begin{align*} -\frac{\frac{3 \,{\left (a^{4} b + a^{2} b^{3} - a b{\left | -a^{3} + a^{2} b \right |} - b^{2}{\left | -a^{3} + a^{2} b \right |}\right )}{\left (\pi \left \lfloor \frac{f x + e}{\pi } + \frac{1}{2} \right \rfloor + \arctan \left (\frac{2 \, \tan \left (f x + e\right )}{\sqrt{\frac{2 \, a^{3} + 2 \, a^{2} b + \sqrt{-16 \, a^{5} b + 4 \,{\left (a^{3} + a^{2} b\right )}^{2}}}{a^{2} b}}}\right )\right )}}{a^{3}{\left | -a^{3} + a^{2} b \right |} + a^{2} b{\left | -a^{3} + a^{2} b \right |} +{\left (a^{3} - a^{2} b\right )}^{2}} + \frac{3 \,{\left (\sqrt{a b}{\left (a + b\right )}{\left | -a^{3} + a^{2} b \right |}{\left | b \right |} +{\left (a^{4} + a^{2} b^{2}\right )} \sqrt{a b}{\left | b \right |}\right )}{\left (\pi \left \lfloor \frac{f x + e}{\pi } + \frac{1}{2} \right \rfloor + \arctan \left (\frac{2 \, \tan \left (f x + e\right )}{\sqrt{\frac{2 \, a^{3} + 2 \, a^{2} b - \sqrt{-16 \, a^{5} b + 4 \,{\left (a^{3} + a^{2} b\right )}^{2}}}{a^{2} b}}}\right )\right )}}{{\left (a^{3} - a^{2} b\right )}^{2} b -{\left (a^{3} b + a^{2} b^{2}\right )}{\left | -a^{3} + a^{2} b \right |}} - \frac{3 \, a \tan \left (f x + e\right )^{2} + 3 \, b \tan \left (f x + e\right )^{2} - a}{a^{2} \tan \left (f x + e\right )^{3}}}{3 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)^4/(a+b*tan(f*x+e)^2),x, algorithm="giac")

[Out]

-1/3*(3*(a^4*b + a^2*b^3 - a*b*abs(-a^3 + a^2*b) - b^2*abs(-a^3 + a^2*b))*(pi*floor((f*x + e)/pi + 1/2) + arct
an(2*tan(f*x + e)/sqrt((2*a^3 + 2*a^2*b + sqrt(-16*a^5*b + 4*(a^3 + a^2*b)^2))/(a^2*b))))/(a^3*abs(-a^3 + a^2*
b) + a^2*b*abs(-a^3 + a^2*b) + (a^3 - a^2*b)^2) + 3*(sqrt(a*b)*(a + b)*abs(-a^3 + a^2*b)*abs(b) + (a^4 + a^2*b
^2)*sqrt(a*b)*abs(b))*(pi*floor((f*x + e)/pi + 1/2) + arctan(2*tan(f*x + e)/sqrt((2*a^3 + 2*a^2*b - sqrt(-16*a
^5*b + 4*(a^3 + a^2*b)^2))/(a^2*b))))/((a^3 - a^2*b)^2*b - (a^3*b + a^2*b^2)*abs(-a^3 + a^2*b)) - (3*a*tan(f*x
 + e)^2 + 3*b*tan(f*x + e)^2 - a)/(a^2*tan(f*x + e)^3))/f